﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Forms;

namespace ImageViewer
{
	/// <summary>
	/// Interaction logic for Window1.xaml
	/// </summary>
	public partial class Viewer : Window
	{
        /// <summary>
        /// 
        /// </summary>
		public Viewer()
		{
			this.InitializeComponent();
			
			// Insert code required on object creation below this point.
		}

        private void OpenImage(object sender, RoutedEventArgs e)
        {
            OpenFileDialog cmd = new OpenFileDialog();
            cmd.CheckFileExists = true;
            cmd.Filter = "JPEG|*.jpg|PNG|*.png|Bitmap|*.bmp|GIF|*.gif|TIFF|*.tiff";
            cmd.Multiselect = false;
            cmd.Title = "Select an image...";
            DialogResult answer = cmd.ShowDialog();
            if (answer == System.Windows.Forms.DialogResult.OK)
            {
                img.Path = cmd.FileName;
                img.RefreshImage();
            }

            cmd.Dispose();
        }
	}
}